package com.yunhe.javabean;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Component;

import javax.annotation.PostConstruct;
import javax.annotation.PreDestroy;

@Data
@NoArgsConstructor
@AllArgsConstructor


@Component
@Scope("singleton")
public class Myself {
    @Value("24")
    private int age;
    @Value("孔志文")
    private String name;
    @Value("男")
    private String sex;

    @PostConstruct
    public void a(){
        System.out.println("Myself初始化");
    }
    @PreDestroy
    public void b(){
        System.out.println("Myself销毁");
    }
}
